#!/bin/sh

all="java php rb py pl"

d=${1:-src}

# build all
make clean compile
rm -rf $d
mkdir -p $d
java Gen -d $d spec.txt

for f in $all; do
    mkdir -p $d/$f
    if [ -e ext/$f ]; then
	cp ext/$f/* $d/$f
    fi
    if [ -f "support.$f" ]; then
        cp "support.$f" $d/$f
    fi
    if [ -f "Support.$f" ]; then
        cp "Support.$f" $d/$f
    fi
done

# java
cd $d/java && javac *.java && cd ../..
